<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="日志管理" libs=["table","bootstrapSelect"]/>
<div class="container-div">
	<div class="row">
	<div class="col-sm-12 search-collapse">
	<@f.form id="operlog-form">
	<div class="select-list">
		<ul>
			<li>
				<label>${i18n("操作人员")}： </label><input type="text" class="form-control" name="operName"/>
			</li>
			<li class="select-selectpicker">
				<label>${i18n("操作类型")}： </label>
				<@f.select name="businessTypes" multiple = true class="selectpicker" dictType="sys_oper_type" required=true/>
			</li>
			<li>
				<label>${i18n("操作状态")}：</label>
				<@f.select name="status" blankValue="" blankLabel="所有" dictType="sys_common_status" />
			</li>
			<li>
				<label>${i18n("操作时间")}： </label>
				<@f.input id="startTime" name="beginTime" type="date" dataCallback="$('#endTime').click()"/>
				<span>-</span>
				<@f.input id="endTime" name="endTime" type="date" selectData="0#1#2#3#4#5#6#7#8#9#10" selectDataClick="startTime#endTime"/>
			</li>
			<li>
				<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;${i18n("查询")}</a>
				<a class="btn btn-warning btn-rounded btn-sm" onclick="opt.form.reset()"><i class="fa fa-refresh"></i>&nbsp;${i18n("重置")}</a>
				<a class="btn btn-default btn-rounded btn-sm" data-toggle="formMore"><i class="fa fa-angle-double-down"></i>&nbsp;${i18n("更多")}</a>
			</li>
		</ul>
	</div>
	<div class="select-list-more">
		<li>
			<label>${i18n("系统模块")}： </label><input type="text" class="form-control" name="title"/>
		</li>
	</div>
	</@f.form>
	</div>
	<@table id="bootstrap-table">
		<@shiro.hasPermission name="sys:log:del">
			<a class="btn btn-danger multiple disabled" onclick="opt.operate.delAll()">
				<i class="fa fa-remove"></i> ${i18n("删除")}
			</a>
		</@shiro.hasPermission>
		<@shiro.hasPermission name="sys:log:clean">
			<a class="btn btn-danger" onclick="opt.operate.clean()">
				<i class="fa fa-trash"></i> ${i18n("清空")}
			</a>
		</@shiro.hasPermission>
	</@table>
	</div>
</div>
<@footer>
<script>
	var detailFlag = "${permission.hasPermi('sys:log:detail')}";
	var datas = ${dict.getDictListJson('sys_oper_type')};
	var prefix = baseURL + "sys/operlog";

	$(function() {
		var options = {
			url: prefix + "/list",
			cleanUrl: prefix + "/clean",
			detailUrl: prefix + "/detail/{id}",
			viewUrl: prefix + "/detail/{id}",
			delUrl: prefix + "/del",
			sortName: "operTime",
			sortOrder: "desc",
			uniqueId: "id", /* 唯一ID */
			height: function(){ return $(window).height() - 100},
			modalName: "${i18n("日志")}",
			escape: true,
			fixedColumns: true,
			fixedNumber: 2,
			rightFixedColumns: true,
			rightFixedNumber: 3,
			showPageGo: true,
			showBorder : true,
			columns: [
			{
				title: "${i18n("序号")}", width: 10, formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
			},
			{
				field: 'title',
				title: '${i18n("系统模块")}'
			},
			{
				field: 'businessType',
				title: '${i18n("操作类型")}',
				align: 'center',
				formatter: function(value, row, index) {
					return opt.common.selectDictLabel(datas, value);
				}
			},
			{
				field: 'operName',
				title: '${i18n("操作人员")}',
				sortable: true
			},
			{
				field: 'compName',
				title: '${i18n("公司名称")}'
			},
			{
				field: 'operIp',
				title: '${i18n("主机")}'
			},
			{
				field: 'operLocation',
				title: '${i18n("操作地点")}',
				formatter: function (value, row, index) {
					return opt.common.tooltip(value,10);
				}
			},
			{
				field: 'status',
				title: '${i18n("操作状态")}',
				align: 'center',
				formatter: function(value, row, index) {
					if (value == 0) {
						return '<span class="badge badge-primary">${i18n("成功")}</span>';
					} else if (value == 1) {
						return '<span class="badge badge-danger">${i18n("失败")}</span>';
					}
				}
			},
			{
				field: 'operTime',
				title: '${i18n("操作时间")}',
				sortable: true
			},
			{
				field: 'ctime',
				title: '${i18n("响应时间")}',
				fieldSort: 'time',//排序字段与显示字段不一致情况 或者a.time 都可以自行根据SQL语句填写
				sortable: true
			},
			{
				title:"${i18n("操作")}",
				align: 'center',
				formatter: function(value, row, index) {
					var actions = [];
					actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="opt.operate.view(\'' + row.id + '\')"><i class="fa fa-search"></i>${i18n("详细")}</a>');
					return actions.join('');
				}
			}]
		};
		$.table.init(options);
	});

	function searchPre() {
		var data = {};
		data.businessTypes = opt.common.join($('#businessTypes').selectpicker('val'));
		$.table.search('bootstrap-table','operlog-form', data);
	}

	function resetPre() {
		$("#businessTypes").selectpicker('refresh');
		$.table.search('bootstrap-table','operlog-form', {});
	}
</script>
</@footer>
</@pageTheme>